/* ******************************
   Comprobantes afip miPyMEs

   Ale - 30/09/2019                                                    
 ********************************/

INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 201, 'A', 'Factura de Credito electronica MiPyMEs (FCE) A', 'N' WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 201);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 202, 'A', 'Nota de Debito electronica MiPyMEs (FCE) A', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 202);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 203, 'A', 'Nota de Credito electronica MiPyMEs (FCE) A ', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 203);

INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 206, 'B', 'Factura de Credito electronica MiPyMEs (FCE) B', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 206);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 207, 'B', 'Nota de Debito electronica MiPyMEs(FCE) B', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 207);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 208, 'B', 'Nota de Credito electronica MiPyMEs (FCE) B', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 208);

INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 211, 'C', 'Factura de Credito electronica MiPyMEs (FCE) C', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 211);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 212, 'C', 'Nota de Debito electronica MiPyMEs (FCE) C', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 212);
INSERT INTO afip.afipcom(tipocomafip, letra, nombre, escomun) SELECT 213, 'C', 'Nota de Credito electronica MiPyMEs (FCE) C', 'N'  WHERE NOT EXISTS (select * from afip.afipcom x where x.tipocomafip = 213);

-- miPyMEs
UPDATE afip.afipcom SET esmipymes = 'S' WHERE tipocomafip IN (201, 202, 203, 206, 207, 208, 211, 212, 213);

-- factura de credito
UPDATE afip.afipcom SET pidevtopago='S', pidecbu='S' WHERE tipocomafip IN (201, 206, 211);

-- notas debito/credito
UPDATE afip.afipcom SET pideesanulacion='S', pidecbtesasoc='S' WHERE tipocomafip IN (202, 203, 207, 208, 212, 213);

-- ===========================
SELECT  aaVersion('412.04');
-- ===========================
